/*
 * Copyright (C) 2013 Codership Oy <info@codership.com>
 *
 * $Id: gu_crc32c.c 3281 2013-09-12 20:35:39Z alex $
 */

#include "gu_crc32c.h"
#include "gu_log.h"

#include <assert.h>

CRC32CFunctionPtr gu_crc32c_func = crc32cSlicingBy8; // some sensible default

void
gu_crc32c_configure()
{
    gu_crc32c_func = detectBestCRC32C();
#ifndef _MSC_VER
    if (gu_crc32c_func == crc32cHardware64 ||
        gu_crc32c_func == crc32cHardware32) {
        gu_info ("CRC-32C: using hardware acceleration.");
    }
    else 
#endif        
    if (gu_crc32c_func == crc32cSlicingBy8) {
        gu_info ("CRC-32C: using \"slicing-by-8\" algorithm.");
    }
    else {
        gu_warn ("unexpected CRC-32C implementation.");
        abort();
    }
}

